Add button to scroll to top when activity list is long.
authorCamila Ayres <hello@camilasan.com>
Wed, 5 Feb 2025 20:29:15 +0000 (21:29 +0100)
committerCamila Ayres <hello@camilasan.com>
Mon, 10 Feb 2025 16:22:04 +0000 (17:22 +0100)
Signed-off-by: Camila Ayres <hello@camilasan.com>
src/gui/tray/ActivityList.qml
theme.qrc.in
theme/chevron-double-up.svg [new file with mode: 0644]

index 99935b48f2ab155a150ea68b85e76910bdf4b8bd..c5196948d56322a27944076720144dfb683161d6 100644 (file)
@@ -114,6 +114,28 @@ ScrollView {
             }
         }
 
+        Button {
+            id: scrollToTopButton
+
+            anchors.bottom: parent.bottom
+            anchors.right: parent.right
+
+            hoverEnabled: true
+            padding: Style.smallSpacing
+
+            Accessible.role: Accessible.Button
+            Accessible.name: qsTr("Scroll to top")
+            Accessible.onPressAction: scrollToTopButton.clicked()
+
+            icon.source: "image://svgimage-custom-color/chevron-double-up.svg/" + palette.buttonText
+            icon.width: Style.activityListButtonIconSize
+            icon.height: Style.activityListButtonIconSize
+
+            onClicked: controlRoot.scrollToTop()
+
+            visible: !controlRoot.atYBeginning && controlRoot.contentHeight > controlRoot.height
+        }
+
         Column {
             id: placeholderColumn
             width: parent.width * 0.8
index 9bb04975573f2b3827ad014257d1607689a41bd4..5f0b5b417582da6774991882cdf5823bd7a89463 100644 (file)
         <file>theme/send.svg</file>
         <file>theme/call-notification.wav</file>
         <file>theme/talk-app.svg</file>
+        <file>theme/chevron-double-up.svg</file>
     </qresource>
 </RCC>
diff --git a/theme/chevron-double-up.svg b/theme/chevron-double-up.svg
new file mode 100644 (file)
index 0000000..3166c17
--- /dev/null
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7.41,18.41L6,17L12,11L18,17L16.59,18.41L12,13.83L7.41,18.41M7.41,12.41L6,11L12,5L18,11L16.59,12.41L12,7.83L7.41,12.41Z" /></svg>
\ No newline at end of file